package com.bean;

import java.sql.Timestamp;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;

import net.sf.json.JSONObject;

/**
 * RulerInfo entity. @author MyEclipse Persistence Tools
 */

public class RulerInfo implements java.io.Serializable {

	// Fields

	/** serialVersionUID*/
	private static final long serialVersionUID = 2345307738870767035L;
	private Integer rulerid;
	private Integer number;//顺序
	private String rulerName;
	private String url;
	private Integer level;
	private Integer echo;
	private Integer manager;
	private String managerName;
	private RulerInfo parent;
	private String target;
	private Integer sortorder;
	private Timestamp lastUpdate;
	private String lastUpdateString;
	private String description;
	private Integer status;
	private String icon;
	private List<RulerInfo> subRulerList = new ArrayList<RulerInfo>();
	private List<RulerMethod> methods;
	private Map<String, RulerMethod> methodmap; //Map<method, RulerMethod>
	
	private Boolean checked;

	// Constructors

	/** default constructor */
	public RulerInfo() {
		level = 1;
		manager = 0;
		echo = 1;
		sortorder = 0;
		status = 1;
	}

	/** full constructor */
	public RulerInfo(String rulerName, String rulerUrl, Integer rulerLevel,
			Integer rulerEcho, Integer rulerManager, String rulerTarget,
			Integer order, Timestamp lastUpdate, Integer status) {
		this.rulerName = rulerName;
		this.url = rulerUrl;
		this.level = rulerLevel;
		this.echo = rulerEcho;
		this.manager = rulerManager;
		this.target = rulerTarget;
		this.sortorder = order;
		this.lastUpdate = lastUpdate;
		this.status = status;
	}

	// Property accessors
	public Integer getRulerid() {
		return rulerid;
	}
	public void setRulerid(Integer rulerid) {
		this.rulerid = rulerid;
	}
	public void setRulerid(String rulerid) {
		this.rulerid = Integer.parseInt(rulerid);
	}

	public String getUrl() {
		return url;
	}

	public Integer getLevel() {
		return level;
	}

	public Integer getEcho() {
		return echo;
	}

	public Integer getManager() {
		return manager;
	}

	public String getManagerName() {
		return managerName;
	}

	public String getTarget() {
		return target;
	}

	public Integer getSortorder() {
		return sortorder;
	}


	public Integer getStatus() {
		return status;
	}



	public void setUrl(String url) {
		this.url = url;
	}

	public void setLevel(Integer level) {
		this.level = level;
	}

	public void setEcho(Integer echo) {
		this.echo = echo;
	}

	public void setManager(Integer manager) {
		this.manager = manager;
	}

	public void setManagerName(String managerName) {
		this.managerName = managerName;
	}

	public void setTarget(String target) {
		this.target = target;
	}

	public void setSortorder(Integer sortorder) {
		this.sortorder = sortorder;
	}


	public void setStatus(Integer status) {
		this.status = status;
	}

	public String getRulerName() {
		return rulerName;
	}


	public void setRulerName(String rulerName) {
		this.rulerName = rulerName;
	}
	
	public void setLastUpdate(String lp) {
		this.setLastUpdate(Timestamp.valueOf(lp));//此处
	}
	public void setLastUpdate(Timestamp lastupdate) {
		DateFormat df = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
		lastUpdateString = df.format(lastupdate);
		this.lastUpdate = lastupdate;
	}

	public String getLastUpdateString() {
		return lastUpdateString;
	}

	public Timestamp getLastUpdate() {
		return lastUpdate;
	}

	@Override
	public String toString() {
		String str="";
		str += JSONObject.fromObject(this);
		return str;
	}

	/**
	 * @return the parent
	 */
	public RulerInfo getParent() {
		return parent;
	}

	/**
	 * @param parent the parent to set
	 */
	public void setParent(RulerInfo parent) {
		this.parent = parent;
	}

	/**
	 * @return the icon
	 */
	public String getIcon() {
		return icon;
	}

	/**
	 * @param icon the icon to set
	 */
	public void setIcon(String icon) {
		this.icon = icon;
	}

	/**
	 * @param lastUpdateString the lastUpdateString to set
	 */
	public void setLastUpdateString(String lastUpdateString) {
		this.lastUpdateString = lastUpdateString;
	}

	/**
	 * @return the subRulerList
	 */
	public List<RulerInfo> getSubRulerList() {
		return subRulerList;
	}

	/**
	 * @param subRulerList the subRulerList to set
	 */
	public void setSubRulerList(List<RulerInfo> subRulerList) {
		this.subRulerList = subRulerList;
	}

	/**
	 * @return the methods
	 */
	public List<RulerMethod> getMethods() {
		return methods;
	}

	/**
	 * @param methods the methods to set
	 */
	public void setMethods(List<RulerMethod> methods) {
		this.methods = methods;
	}

	/**
	 * @return the number
	 */
	public Integer getNumber() {
		return number;
	}

	/**
	 * @param number the number to set
	 */
	public void setNumber(Integer number) {
		this.number = number;
	}

	/**
	 * @return the methodmap
	 */
	public Map<String, RulerMethod> getMethodmap() {
		return methodmap;
	}

	/**
	 * @param methodmap the methodmap to set
	 */
	public void setMethodmap(Map<String, RulerMethod> methodmap) {
		this.methodmap = methodmap;
	}

	/**
	 * @return the checked
	 */
	public Boolean getChecked() {
		return checked;
	}

	/**
	 * @param checked the checked to set
	 */
	public void setChecked(Boolean checked) {
		this.checked = checked;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}



}